<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="app" uri="/WEB-INF/tld/app.tld" %>
<%@ taglib prefix="ct" uri="/WEB-INF/tld/commonTag.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/jsp/common/common_header.jsp" %>
<%@ include file="/WEB-INF/jsp/common/common.jsp" %>

	<script language="javascript">
	
	$(function(){
		   $("#detail_img").click(function(){
		      $("#detail_imgt_pop").hide("slow");
		   }); 
	});	
	
	
	function detailView(obj) {
		   $("#detail_img").attr("src", obj.src);
		   $("#detail_imgt_pop").show("slow");
	}
		 


	function funcFileUpload(id, num) {

		var userId = $("#userId").val();
		var file= $("#"+id).val();
	    var fileNm =file.substring(file.lastIndexOf('\\') + 1, file.lastIndexOf('.')) + "." +  file.substring(file.lastIndexOf('.') + 1, file.length);
        var fileFormat = file.substring(file.lastIndexOf('.') + 1, file.length);

        if(!file){
            alert("파일을 선택하세요.");
            return;
        }
    	if(!(fileFormat == "jpg" || fileFormat == "JPG" || fileFormat == "gif" || fileFormat == "png" || fileFormat == "jpeg"))
    	{
    		alert("jpg, gif, png 파일만 지원 됩니다.");
    		
    		return;
    	}        
		
    	
        var url = "ajaxFileImgUpload.do";   
        
        $("#uploadForm").attr("action",url);
        $("#num").val(num);
        
        var frm = $('#uploadForm');
        var stringData = frm.serialize();
        
        
        frm.ajaxSubmit({
            type: "post",
            url: url,
            data: stringData,
	        success : function(data) {
            	if(data.indexOf('success')> -1){
            		alert(" 파일 업로드 성공");	
            		self.location.reload(); 
            	}else{
            		alert(" 파일 업로드 실패");
            	}
	        },
	        error : function(data) {
	            alert("통신에러 입니다. 관리자에게 문의 바랍니다.");
	           
	        }

        });         
	} 
	
	
	function goUrl(url) {
		location.href=url;
	}     
	
	
    
    
    
	</script>
</head>
<body>
<div id="detail_imgt_pop"  style="display:none; position:absolute; left:500px; top:1px; width:238px; z-index:1; height: 137px;">
        <table cellpadding="0" cellspacing="0" border="0" class="data_table_01" width="100%">
            <tr>
				<img  id="detail_img" src="" />
            </tr>     
		</table>            
</div>
<div class="con_area" style="width: 800px">
<form id="uploadForm" name="uploadForm" method ="post" enctype="multipart/form-data">
<input type="hidden" id="userId" name="userId" value="${model.user_id}"/>
<input type="hidden" id="num" name="num"/>

<br><br>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr>
        <td align="left"><h2 class="tit"> 문서 관리 상세조회</h2></td>
        <td align="right"><span>회원정보 > <b> 문서 관리 상세조회  </b></span></td>
    </tr>
</table>
<br>

    <div style="margin-top:7px"/>
        <table cellpadding="0" cellspacing="0" border="0" class="data_table_01" width="100%">
  			<tr>
				<td class="data_01" style='width:150px; text-align:left;'>&nbsp;* 대표자 신분증 앞&nbsp;</td>
				<td class="data_02" class="image">&nbsp;
					<img src="${vo.ceoSsnFFilePath}" id="ceoSsnfileFrontImg"  onclick="detailView(this);" width="180px" height="80px" onerror="this.src='${pageContext.request.contextPath }/images/img_118_118.gif'"/><br><br>
					<input  type="file" name="ceoSsnfileFront" id="ceoSsnfileFront" >
                	&nbsp;&nbsp;
                	<input type="button" class="button_63_01" value="등록" style="width:65px; align=center" onclick="funcFileUpload('ceoSsnfileFront','1');"/>
				</td>
				
			</tr>	     
  			<tr>
				<td class="data_01" style='width:150px; text-align:left;'>&nbsp;* 대표자 신분증 뒤&nbsp;</td>
				<td class="data_02" class="image">&nbsp;
					<img src="${vo.ceoSsnBFilePath}" id="ceoSsnfileBehindImg" width="180px" height="80px"  onclick="detailView(this);" onerror="this.src='${pageContext.request.contextPath }/images/img_118_118.gif'"/><br><br>
					<input type="file" name="ceoSsnfileBehind" id="ceoSsnfileBehind" >
                	&nbsp;&nbsp;
                	<input type="button" class="button_63_01" value="등록" style="width:65px; align=center" onclick="funcFileUpload('ceoSsnfileBehind','2');"/>
				</td>
			</tr>		
  			<tr>
				<td class="data_01" style='width:150px; text-align:left;'>&nbsp;* 대표자 인감증명서&nbsp;</td>
				<td class="data_02" class="image">&nbsp;
					<img src="${vo.ceoIngamFilePath}" id="ceoIngamfileImg" width="180px" height="80px"   onclick="detailView(this);" onerror="this.src='${pageContext.request.contextPath }/images/img_118_118.gif'"/><br><br>
					<input type="file" name="ceoIngamfile" id="ceoIngamfile" >
                	&nbsp;&nbsp;
                	<input type="button" class="button_63_01" value="등록" style="width:65px; align=center" onclick="funcFileUpload('ceoIngamfile','3');"/>
				</td>
			</tr>		
  			<tr>
				<td class="data_01" style='width:150px; text-align:left;'>&nbsp;* 대표자 등본&nbsp;</td>
				<td class="data_02" class="image">&nbsp;
					<img src="${vo.ceoDungbonFilePath}" id="ceoDungBonfileImg" width="180px" height="80px"  onclick="detailView(this);" onerror="this.src='${pageContext.request.contextPath }/images/img_118_118.gif'"/><br><br>
					<input type="file" name="ceoDungBonfile" id="ceoDungBonfile" >
                	&nbsp;&nbsp;
                	<input type="button" class="button_63_01" value="등록" style="width:65px; align=center" onclick="funcFileUpload('ceoDungBonfile','4');"/>
				</td>
			</tr>	
  			<tr>
				<td class="data_01" style='width:150px; text-align:left;'>&nbsp;* 사업자등록증&nbsp;</td>
				<td class="data_02" class="image">&nbsp;
					<img src="${vo.busLiceFilePath}" id="busLicefileImg" width="180px" height="80px"  onclick="detailView(this);" onerror="this.src='${pageContext.request.contextPath }/images/img_118_118.gif'"/><br><br>
					<input type="file" name="busLicefile" id="busLicefile" >
                	&nbsp;&nbsp;
                	<input type="button" class="button_63_01" value="등록" style="width:65px; align=center" onclick="funcFileUpload('busLicefile','5');"/>
				</td>
			</tr>	
  			<tr>
				<td class="data_01" style='width:150px; text-align:left;'>&nbsp;* 석판&nbsp;</td>
				<td class="data_02" class="image">&nbsp;
					<img src="${vo.sukFanFilePath}" id="sukFanfileImg" width="180px" height="80px"  onclick="detailView(this);" onerror="this.src='${pageContext.request.contextPath }/images/img_118_118.gif'"/><br><br>
					<input type="file" name="sukFanfile" id="sukFanfile" >
                	&nbsp;&nbsp;
                	<input type="button" class="button_63_01" value="등록" style="width:65px; align=center" onclick="funcFileUpload('sukFanfile','6');"/>
				</td>
			</tr>	
  			<tr>
				<td class="data_01" style='width:150px; text-align:left;'>&nbsp;* 주유소 입금통장&nbsp;</td>
				<td class="data_02" class="image">&nbsp;
					<img src="${vo.gasBankFilePath}" id="gasBankfileImg" width="180px" height="80px"  onclick="detailView(this);" onerror="this.src='${pageContext.request.contextPath }/images/img_118_118.gif'"/><br><br>
					<input type="file" name="gasBankfile" id="gasBankfile" >
                	&nbsp;&nbsp;
                	<input type="button" class="button_63_01" value="등록" style="width:65px; align=center" onclick="funcFileUpload('gasBankfile','7');"/>
				</td>
			</tr>		
  			<tr>
				<td class="data_01" style='width:150px; text-align:left;'>&nbsp;*  국세완납증명서&nbsp;</td>
				<td class="data_02" class="image">&nbsp;
					<img src="${vo.taxComFilePath}" id="taxComfileImg" width="180px" height="80px"  onclick="detailView(this);" onerror="this.src='${pageContext.request.contextPath }/images/img_118_118.gif'"/><br><br>
					<input type="file" name="taxComfile" id="taxComfile" >
                	&nbsp;&nbsp;
                	<input type="button" class="button_63_01" value="등록" style="width:65px; align=center" onclick="funcFileUpload('taxComfile','8');"/>
				</td>
			</tr>		
  			<tr>
				<td class="data_01" style='width:150px; text-align:left;'>&nbsp;*  지방세완납증명서&nbsp;</td>
				<td class="data_02" class="image">&nbsp;
					<img src="${vo.jibangTaxComFilePath}" id="JibangTaxComfileImg" width="180px" height="80px"  onclick="detailView(this);" onerror="this.src='${pageContext.request.contextPath }/images/img_118_118.gif'"/><br><br>
					<input type="file" name="JibangTaxComfile" id="JibangTaxComfile" >
                	&nbsp;&nbsp;
                	<input type="button" class="button_63_01" value="등록" style="width:65px; align=center" onclick="funcFileUpload('JibangTaxComfile','9');"/>
				</td>
			</tr>																				    
        </table>        
	
	</form>
</div>       
<br><br>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr>
        <td align="center">
	        <input type="button" class="button_63_01" value="목록" style="width:65px; align=center" onclick="goUrl('memberDocuList.do?pageNo=1')"/>
        </td>
    </tr>
</table>
<br>
<br>
<br>
 
</body>
